import React, { Component } from "react";
import { SwipeAction, List, NoticeBar } from "antd-mobile";
import { get } from "../../../../utils/Axios";
import "./index.scss";
class RenderListContent extends Component {
  state = {
    renderDataList: [],
  };

  componentDidMount() {
    get("/user/houses").then((result) => {
      this.setState({
        renderDataList: result.data.body,
      });
    });
  }

  render() {
    const { renderDataList } = this.state;
    return (
      <div className="renderListContentWrapper">
        <NoticeBar marqueeProps={{ loop: true, style: { padding: "0 7.5px" } }}>
          要认真学习贯彻习近平总书记对当前疫情防控工作的重要指示精神，按照全国疫情防控工作电视电话会议部署要求，坚持把疫情防控工作当作重中之重，保持清醒头脑，务实精准施策，切实抓好常态化疫情防控，为经济社会持续健康发展营造良好环境。要严格落实“外防输入、内防反弹”各项措施，充分运用“大数据+网格化”手段，坚持“人、物、环境”同防，加大重点场所和特殊场所防控力度，持续提升预警快速反应和多部门协同作战能力，安全有序推进疫苗接种，切实筑牢疫情防控屏障。要坚持守土有责、守土担责、守土尽责，全面强化疫情防控工作责任，确保疫情防控工作落细落实。
        </NoticeBar>
        <List>
          {renderDataList &&
            renderDataList.map((one) => {
              return (
                <SwipeAction
                  style={{ backgroundColor: "gray" }}
                  autoClose
                  right={[
                    {
                      text: "修改",
                      onPress: () => console.log("修改"),
                      style: { backgroundColor: "#ddd", color: "white" },
                    },
                    {
                      text: "删除",
                      onPress: () => console.log("删除"),
                      style: { backgroundColor: "#F4333C", color: "white" },
                    },
                  ]}
                  onOpen={() => console.log("global open")}
                  onClose={() => console.log("global close")}
                >
                  <List.Item
                    extra="More"
                    arrow="horizontal"
                    onClick={() => console.log("List.Item clicked!")}
                  >
                    <div className="renderItem">
                      <div className="img">
                        <img
                          src={one.houseImg.replace("/newImg/", "")}
                          alt=""
                        />
                      </div>
                      <div className="content">
                        <div className="title">{one.title}</div>
                        <div className="second">{one.desc}</div>
                      </div>
                    </div>
                  </List.Item>
                </SwipeAction>
              );
            })}
        </List>
      </div>
    );
  }
}

export default RenderListContent;
